define(function(require){
    var
        _ = require('underscore'),
        RS = require('core/reqres'),
        NC = require('core/event'),
        Marionette = require('marionette'),
        Utils = require('core/utils');

    var
        template = require('text!components/image/2.0.0/templates/upload.html'),
        NetworkView = require('components/image/2.0.0/views/upload_network'),
        LocalView = require('components/image/2.0.0/views/upload_local');

    return Marionette.Layout.extend({

        template: _.template(template),

        regions: {
            networkRegion: '.js-upload-network-region',
            localRegion: '.js-upload-local-region',
        },

        initialize: function(options) {
            this.options = options || {};
        },

        onBeforeRender: function() {
            this.appOptions = RS.request('widget:image:app:options');
        },

        onRender: function() {
            if(this.appOptions.hideDownload) {
                this.networkRegion.close();
            } else {
                this.networkRegion.show(new NetworkView());
            }
            this.localRegion.show(new LocalView());
        },

        clean: function() {

        }

    });
});
